package com.dragee.modules.work.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.dragee.common.PageUtils;
import com.dragee.constants.CommonConstants;
import com.dragee.modules.work.dao.UserExpanderDao;
import com.dragee.modules.work.entity.UserExpanderEntity;
import com.dragee.modules.work.po.UserExpanderPo;
import com.dragee.modules.work.service.UserExpanderService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

@Service("userExpanderService")
public class UserExpanderServiceImpl extends ServiceImpl<UserExpanderDao, UserExpanderEntity> implements UserExpanderService {


    @Resource
    private UserExpanderDao userExpanderDao;

    private String business = "userExpander";
    /**
    * 列表
    */
    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        int limit = params.get(CommonConstants.LIMIT) == null
                ?CommonConstants.LIMIT_SIZE:Integer.parseInt(params.get(CommonConstants.LIMIT).toString());
        int start = params.get(CommonConstants.START) == null
                ?CommonConstants.START_SIZE:Integer.parseInt(params.get(CommonConstants.START).toString());
        PageHelper.startPage(start, limit);
        List<UserExpanderPo> datas = userExpanderDao.queryPage(params.get("name"), params.get("phone"));
        PageInfo pageInfo = new PageInfo(datas);
        return new PageUtils(pageInfo);
    }
}